package com.cloudwise.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cloudwise.dao.ResultDao;
import com.cloudwise.entity.Result;
import com.cloudwise.service.ResultService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * (Result)表服务实现类
 *
 * @author makejava
 * @since 2021-11-26 17:38:36
 */
@Service("resultService")
public class ResultServiceImpl extends ServiceImpl<ResultDao, Result> implements ResultService {
    @Override
    public List<Result> findResultByTesterId(Integer testerId) {
        QueryWrapper wrapper = new QueryWrapper<Result>().eq("tester_id", testerId);
        return this.list(wrapper);
    }

    @Override
    public boolean removeByTesterIds(List<Long> idList) {
        boolean suc = false;
        for(Long id : idList){
            suc = this.remove(new QueryWrapper<Result>().eq("tester_id", id));
        }
        return suc;
    }

    @Override
    public int resultCount() {
        return (this.count() / 30);
    }
}

